<template>
	<view class="service_discount">
		<view v-if="list" class="container"
			:style="{ backgroundImage: `url(${list.bg_image.file_path})`,backgroundRepeat: 'no-repeat'  }" >
			<view class="location">
				<view class="location-name">
					<view class="location-box">
						<u-icon name="map"></u-icon> <text class="loc">{{maplocation['city']?maplocation['city']:''}}</text>
					</view>
				</view>
				<view class="become">
					<image :show-menu-by-longpress="true" class="becomeImage" :src="list.qr_code.file_path"></image>
				</view>
			</view>
		</view>
		<view v-else class="stayTunedBox">
			<image class="stayTunedImg" src="@/static/stay-tuned.png" mode="widthFix"></image>
			<view class="stayTunedTxt">敬请期待...</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				list:{
					bg_image:{
						file_path:''
					},
					qr_code:{
						file_path:''
					}
				}
			};
		},
		computed: {
			...mapState(['maplocation', 'dataloaded', 'mapaddressid', 'vuex_showdg', 'vuex_address', 'vuex_mapid']),
		},
		mounted() {
			uni.$u.api.welfareOfficer().then(res => {
				console.log(res)
				this.list = res.list
			})
			
		}
	}
</script>

<style lang="scss">
	.service_discount {
		overflow: hidden;
		.container{
			// background: url({{list.bg_image.file_path}}) no-repeat;
			background-size: 100% 100vh;
			background-color: #F6F6F6;
		}
		.stayTunedBox {
			background-color: #fff;
			text-align: center;
			padding-top: 220rpx;
			.stayTunedImg {
				width: 100rpx;
			}
			.stayTunedTxt {
				padding-top: 40rpx;
			}
		}
		.become {
			display: flex;
			justify-content: center;
			align-items: center;

			.becomeImage {
				width: 300rpx;
				height: 300rpx;
			}
		}

		.location {
			padding-top: 35vh;
			padding-left: 60rpx;
			padding-right: 60rpx;
			font-weight: bold;
			color: #fff;

			.location-name{
				padding:10rpx 20rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				
				.location-box{
					text-align: center;
					background-color: #BB0024;
					border-radius: 10rpx;
					width: 200rpx;
					height: 60rpx;
					line-height: 60rpx;
				}
				.loc {
					margin-left: 10rpx;
				}
			}
			
		}
	}
</style>